home *** CD-ROM | disk | FTP | other *** search
Text File | 2011-10-17 | 41.9 KB | 1,244 lines |
- class classes.enemy.DeathHead
- {
- var x;
- var y;
- var clip;
- var fire;
- var transL;
- var transR;
- var colorTrans;
- var eyes;
- var f2;
- var dir;
- var moveScript;
- var axis;
- var xDest;
- var yDest;
- var wallDir;
- var wallC;
- var wallEP;
- var ep;
- var enemyType;
- var darkL;
- var oldF;
- var oldDir;
- var xMov = 0;
- var yMov = 0;
- var xMovT = 0;
- var yMovT = 0;
- var speedOrig = 6;
- var speed = 6;
- var xDestMet = false;
- var yDestMet = false;
- var c = 0;
- var life = 3500;
- var lifeOrig = 3500;
- var nc = 0;
- var xA = 0;
- var yA = 0;
- var nudging = false;
- var hc = 0;
- var power = 30;
- var permitHit = false;
- var phase = 1;
- var cv = 0.25;
- var dark = false;
- var centered = false;
- var cc = 0;
- var Name = "deathHead";
- function DeathHead()
- {
- this.x = 500;
- this.y = 300;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("deathHead","deathHeadClip",_root.d + 690000);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.clip.gotoAndPlay("intro");
- this.fire = new Object();
- this.speed *= _root.dif.speed;
- this.speedOrig = this.speed;
- this.transL = new flash.geom.Transform(this.clip.eyeClip.eyeL);
- this.transR = new flash.geom.Transform(this.clip.eyeClip.eyeR);
- this.colorTrans = new flash.geom.ColorTransform(1,0,0,1,255,0,0,0);
- this.eyes = new Object();
- this.eyes.lO = 0;
- this.eyes.rO = 14;
- this.eyes.c = 0;
- this.eyes.x = 0;
- _root.stats.created = _root.stats.created + 1;
- this.clip.teeth.gotoAndPlay("go");
- this.f2 = "intro";
- _root.lastBoss = true;
- }
- function intro()
- {
- this.c = this.c + 1;
- if(Math.round(this.c / 10) == this.c / 10)
- {
- var _loc3_ = this.c / 10;
- if(_loc3_ > 13)
- {
- _loc3_ = 13;
- }
- this.clip.eyeClip.eyeL.gotoAndStop(_loc3_ + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(_loc3_ + this.eyes.rO);
- }
- if(this.c == 150)
- {
- _root.audio.playLevel2("deathIntro",_root.randRange(20,25));
- _root.audio.playLevel3("deathDrain",_root.randRange(15,20));
- _root.powerUpDrain = new classes.fx.PowerUpDrain(_root[_root.char].x + 3,_root[_root.char].y + 3);
- _root.addFX("powerUpDrain");
- _root[_root.char].weapon = _root.bro1Weapon = _root.bro2Weapon = "laserA";
- _root[_root.char].fireFreq = 11;
- _root[_root.char].fireFreqOrig = 11;
- _root.rapidVar = 4;
- }
- if(this.c > 150 && this.c < 170)
- {
- if(Math.round(this.c / 2) == this.c / 2)
- {
- this.clip.eyeClip.eyeL.blast.gotoAndStop(2);
- this.clip.eyeClip.eyeR.blast.gotoAndStop(2);
- _root[_root.char].colorFlash(255,255,255,2);
- }
- else
- {
- this.clip.eyeClip.eyeL.blast.gotoAndStop(1);
- this.clip.eyeClip.eyeR.blast.gotoAndStop(1);
- }
- }
- if(this.c == 170)
- {
- this.clip.eyeClip.eyeL.blast.gotoAndPlay(2);
- this.clip.eyeClip.eyeR.blast.gotoAndPlay(2);
- this.f2 = "wander";
- }
- }
- function nudge(pxA, pyA, pscale)
- {
- this.nc = 0;
- this.nudging = true;
- var _loc2_ = pscale / 100;
- this.xA = pxA * _loc2_;
- this.yA = pyA * _loc2_;
- }
- function speedVar()
- {
- if(random(3) == 1)
- {
- this.speed *= _root.randRange2(0.9,1.1);
- }
- if(this.speed >= this.speedOrig * 1.3)
- {
- this.speed = this.speedOrig;
- }
- }
- function parseMoveScript()
- {
- this.dir = this.moveScript[0];
- if(this.dir == "break")
- {
- delete this.moveScript;
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.f2 = "gotoXYDest";
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- if(this.dir == "L" || this.dir == "U")
- {
- this[this.axis + "Dest"] = this[this.axis] - this.moveScript[1];
- }
- else
- {
- this[this.axis + "Dest"] = this[this.axis] + this.moveScript[1];
- }
- this.moveScript.splice(0,2);
- }
- }
- function gotoXYDest()
- {
- if(Math.abs(this[this.axis + "Dest"] - this[this.axis]) < this.speed + 1)
- {
- if(this.axis == "x")
- {
- this.x = this.xDest;
- }
- else
- {
- this.y = this.yDest;
- }
- this.parseMoveScript();
- }
- }
- function getDirString()
- {
- if(this.xMovT < -1)
- {
- this.dir = "L";
- }
- else if(this.xMovT > 1)
- {
- this.dir = "R";
- }
- else if(this.yMovT > 1)
- {
- this.dir = "D";
- }
- else if(this.yMovT < -1)
- {
- this.dir = "U";
- }
- }
- function wander()
- {
- if(random(100) > 70 || (this.x > 950 || this.x < 50 || this.y < 50 || this.y > 550))
- {
- if(random(50) > 48)
- {
- this.wait();
- }
- else if(random(10) > 1)
- {
- this.dir = _root.getDir(this.x,this.y);
- this[this.axis + "MovT"] = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- if(this.phase < 6)
- {
- if(random(200) > 197 + _root.dif.wait)
- {
- if(random(7) == 0 && !this.dark)
- {
- this.darkness();
- }
- else if(random(5) > 0)
- {
- this.fireLaser();
- }
- else if(!this.dark)
- {
- this.astroAttack();
- }
- }
- }
- else if(random(200) > 196 + _root.dif.wait)
- {
- if(random(2) > 0 && _root.chars.length < 4)
- {
- this.blackEnemies();
- }
- else if(random(3) > 0)
- {
- this.deathBallAttack();
- }
- else if(random(2) > 0)
- {
- this.fireLaser();
- }
- else if(this.x > 200 && this.x < 800)
- {
- this.wall();
- }
- }
- }
- function wall()
- {
- this.permitHit = false;
- this.wallDir = random(2) != 0 ? "D" : "U";
- this.xMovT = 0;
- this.yMovT = 0;
- this.f2 = "walling";
- this.c = 0;
- this.wallC = 0;
- this.wallEP = _root.randRange(3,7);
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,255,160,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- _root.audio.playLevel2("deathWall",_root.randRange(15,20));
- }
- function walling()
- {
- this.c = this.c + 1;
- if(this.c < 150)
- {
- var _loc5_ = this.wallDir != "U" ? 0.5 : -0.5;
- }
- else
- {
- _loc5_ = this.wallDir != "U" ? -0.5 : 0.5;
- }
- this.yMov = this.yMovT += _loc5_;
- if(this.c == 300)
- {
- this.permitHit = true;
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- this.f2 = "wander";
- if(this.y > 650)
- {
- this.y = -40;
- }
- if(this.y < -50)
- {
- this.y = 620;
- }
- }
- this.wallC = this.wallC + 1;
- if(this.wallC >= this.wallEP)
- {
- var _loc3_ = this.x <= _root[_root.char].x ? "R" : "L";
- var _loc6_ = _loc3_ != "R" ? -21 : 21;
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["bugASwitchBlast" + _root.enemyShotID] = new classes.shots.BugASwitchBlast(this.x + _loc6_,this.y + 21,_loc3_,_root.enemyShotID,true);
- _root.addEnemyShot("bugASwitchBlast" + _root.enemyShotID);
- _root.audio.playLevel3("deathWallFire" + (random(3) + 1),_root.randRange(12,16));
- this.wallEP = _root.randRange(3,7);
- this.wallC = 0;
- }
- if(this.c > 45 && this.c < 245)
- {
- if(random(4) == 0)
- {
- var _loc4_ = this.x <= _root[_root.char].x ? 2 : 1;
- _root.fxID = _root.fxID + 1;
- _root["deathWallFX" + _root.fxID] = new classes.fx.DeathWallFX(this.x,this.y,this.wallDir,_loc4_,_root.fxID);
- _root.addFX("deathWallFX" + _root.fxID);
- }
- }
- }
- function blackEnemies()
- {
- this.cc = 0;
- this.ep = _root.randRange(8,30);
- this.f2 = "creatingEnemies";
- this.enemyType = _root.randRange(1,4);
- _root.audio.playLevel2("deathEnemyLaunch",_root.randRange(20,25));
- }
- function creatingEnemies()
- {
- this.cc = this.cc + 1;
- this.xA = _root.randRange2(-3,3);
- this.yA = _root.randRange2(-3,3);
- var _loc3_ = ["L","R","U","D"];
- if(Math.round(this.cc / 2) == this.cc / 2)
- {
- this["createEnemy" + this.enemyType](_loc3_[random(4)]);
- }
- if(this.cc >= this.ep)
- {
- this.f2 = "wander";
- this.xA = this.yA = 0;
- }
- }
- function deathBallAttack()
- {
- _root.audio.playLevel2("deathBallLaunch",_root.randRange(12,18));
- this.cc = 0;
- this.ep = _root.randRange(10,26);
- this.f2 = "deathBallAttacking";
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- }
- function deathBallAttacking()
- {
- this.cc = this.cc + 1;
- if(Math.round(this.cc / 2) == this.cc / 2)
- {
- this.deathBall();
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,_root.randRange(-150,150),_root.randRange(-10,10),_root.randRange(-10,10),0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- if(this.cc >= this.ep)
- {
- this.f2 = "wander";
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- }
- function deathBall()
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathBall" + _root.enemyShotID] = new classes.shots.DeathBall(this.x,this.y,this.xMov * -1,this.yMov * -1,_root.enemyShotID);
- _root.addEnemyShot("deathBall" + _root.enemyShotID);
- }
- function darkness()
- {
- this.f2 = "darkening";
- this.dark = true;
- this.c = 0;
- _root.attachMovie("deathDark","deathDarkClip",25);
- _root.deathDarkClip._x = 0;
- _root.deathDarkClip._y = 0;
- this.darkL = _root.randRange(150,240);
- this.speed *= 1.5;
- _root.audio.playLevel2("deathDark2",_root.randRange(20,25));
- }
- function darkening()
- {
- this.c = this.c + 1;
- if(random(100) > 50 || (this.x > 950 || this.x < 50 || this.y < 50 || this.y > 550))
- {
- if(random(10) > 1)
- {
- this.dir = _root.getDir(this.x,this.y);
- this[this.axis + "MovT"] = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- if(this.c < 26)
- {
- if(Math.round(this.c / 2) == this.c / 2)
- {
- var _loc3_ = this.c / 2;
- if(_loc3_ > 13)
- {
- _loc3_ = 13;
- }
- this.clip.eyeClip.eyeL.gotoAndStop(_loc3_ + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(_loc3_ + this.eyes.rO);
- }
- this.clip.cover._alpha = 100 - this.c * 4;
- }
- if(this.c > 25)
- {
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- }
- if(this.c == 30)
- {
- _root.deathDarkClip.play();
- this.clip.cover._alpha = 0;
- }
- if(this.c > 30 && this.c < 60)
- {
- var _loc5_ = 1 - (this.c - 30) / 30;
- var _loc4_ = - (this.c - 30) * 8.5;
- this.colorTrans = new flash.geom.ColorTransform(_loc5_,_loc5_,_loc5_,1,_loc4_,_loc4_,_loc4_,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- if(this.c > 60 && this.c < 90)
- {
- _loc5_ = (this.c - 60) / 30;
- _loc4_ = -255 + (this.c - 60) * 8.5;
- this.colorTrans = new flash.geom.ColorTransform(_loc5_,_loc5_,_loc5_,1,_loc4_,_loc4_,_loc4_,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- if(_root.deathDarkClip.end)
- {
- _root.deathDarkClip.removeMovieClip();
- this.clip.cover._alpha = 100;
- this.dark = false;
- this.f2 = "wander";
- this.speed = this.speedOrig;
- }
- }
- function astroAttack()
- {
- this.f2 = "astroAttacking";
- this.c = 0;
- this.xMovT = 0;
- this.yMovT = 0;
- var _loc4_ = 0;
- var _loc5_ = _root.randRange(5,9);
- while(_loc4_ < _loc5_)
- {
- var _loc3_ = random(4);
- _root.fxID = _root.fxID + 1;
- _root["asteroidD" + _root.fxID] = new classes.fx.AsteroidD(_root.randRange(_root.posArray[_loc3_][0],_root.posArray[_loc3_][1]),_root.randRange(_root.posArray[_loc3_][2],_root.posArray[_loc3_][3]),_root.randRange(4,5),_root.dirArray[_loc3_],_root.fxID);
- _root.addFX("asteroidD" + _root.fxID);
- _loc4_ = _loc4_ + 1;
- }
- }
- function astroAttacking()
- {
- this.c = this.c + 1;
- if(this.c < 30)
- {
- if(Math.round(this.c / 2) == this.c / 2)
- {
- var _loc5_ = this.c / 2;
- if(_loc5_ > 13)
- {
- _loc5_ = 13;
- }
- this.clip.eyeClip.eyeL.gotoAndStop(_loc5_ + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(_loc5_ + this.eyes.rO);
- }
- }
- if(this.c > 45 && this.c < 65)
- {
- var _loc6_ = this.c >= 55 ? 1 - (this.c - 54) / 10 : (this.c - 45) / 10;
- this.xA = _root.randRange2(-6,6) * _loc6_;
- this.yA = _root.randRange2(-6,6) * _loc6_;
- }
- if(this.c == 55)
- {
- _root.audio.playLevel2("deathAstCrush",_root.randRange(40,50));
- var _loc3_ = 0;
- var _loc4_ = _root.FX.length;
- while(_loc3_ < _loc4_)
- {
- _root[_root.FX[_loc3_]].explode();
- _loc3_ = _loc3_ + 1;
- }
- }
- if(this.c == 65)
- {
- this.xA = this.yA = 0;
- }
- if(this.c == 68)
- {
- _root.audio.playLevel2("deathAstGuide",_root.randRange(24,29));
- _loc3_ = 0;
- _loc4_ = _root.FX.length;
- while(_loc3_ < _loc4_)
- {
- _root[_root.FX[_loc3_]].stopMov();
- _loc3_ = _loc3_ + 1;
- }
- }
- if(this.c == 78)
- {
- _loc3_ = 0;
- _loc4_ = _root.FX.length;
- while(_loc3_ < _loc4_)
- {
- _root[_root.FX[_loc3_]].attack();
- _loc3_ = _loc3_ + 1;
- }
- }
- if(this.c == 90)
- {
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- this.oldF = this.clip.eyeClip.eyeL._currentframe - this.eyes.lO;
- this.f2 = "wander";
- }
- }
- function wait()
- {
- this[this.axis + "MovT"] = 0;
- this.f2 = "waiting";
- this.c = 0;
- this.ep = _root.randRange(30,120);
- this.ep *= 1 / _root.dif.speed;
- this.clip.teeth.gotoAndStop("stop");
- }
- function waiting()
- {
- this.c = this.c + 1;
- if(this.c >= this.ep)
- {
- this.f2 = "wander";
- this.clip.teeth.gotoAndPlay("go");
- if(random(10) > 2)
- {
- this.dir = _root.getDir(this.x,this.y);
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- }
- else
- {
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- }
- function fireLaser()
- {
- this.xMovT = 0;
- this.yMovT = 0;
- this.fire.c = 0;
- this.f2 = "firing";
- _root.audio.playLevel3("deathLaserFire",_root.randRange(15,20));
- this.fire.eyesA = 100;
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- this.colorTrans = new flash.geom.ColorTransform(0,0,0,1,-255,-255,-255,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- function firing()
- {
- this.fire.c = this.fire.c + 1;
- if(this.fire.c < 15)
- {
- if(this.fire.eyesA == 0)
- {
- this.fire.eyesA = 100;
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- }
- else
- {
- this.colorTrans = new flash.geom.ColorTransform(0,0,0,1,-255,-255,-255,0);
- this.fire.eyesA = 0;
- }
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- if(this.fire.c == 15)
- {
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- this.clip.eyeClip.eyeL.blast.play();
- this.clip.eyeClip.eyeR.blast.play();
- var _loc3_ = _root.getDir(this.x,this.y);
- if(_loc3_ == "L")
- {
- var _loc4_ = this.x - 51;
- var _loc5_ = this.y + 6;
- }
- else if(_loc3_ == "R")
- {
- _loc4_ = this.x + 21;
- _loc5_ = this.y + 6;
- }
- else if(_loc3_ == "U")
- {
- _loc4_ = this.x + 12;
- _loc5_ = this.y - 51;
- }
- else
- {
- _loc4_ = this.x + 12;
- _loc5_ = this.y + 15;
- }
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathLaser" + _root.enemyShotID] = new classes.shots.DeathLaser(_loc4_,_loc5_,_loc3_,true,_root.enemyShotID);
- _root.addEnemyShot("deathLaser" + _root.enemyShotID);
- }
- if(this.fire.c == 16)
- {
- this.f2 = "wander";
- if(random(10) > 2)
- {
- this.dir = _root.getDir(this.x,this.y);
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- this.speedVar();
- }
- else
- {
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- }
- function death()
- {
- this.phase = 7;
- _root.playBGSound(["deathLoop",0,6,0.05]);
- _root[_root.char].xA = _root[_root.char].yA = 0;
- _root.stats.destroyed = _root.stats.destroyed + 1;
- _root.stats.score += 100000;
- var _loc3_ = 1;
- var _loc5_ = _root.chars.length;
- while(_loc3_ < _loc5_)
- {
- _root[_root.chars[_loc3_]].bombed(100);
- _loc3_ = _loc3_ + 1;
- }
- var _loc4_ = _root.enemyShots.slice();
- _loc3_ = 0;
- _loc5_ = _loc4_.length;
- while(_loc3_ < _loc5_)
- {
- _root.removeEnemyShot(_loc4_[_loc3_]);
- _loc3_ = _loc3_ + 1;
- }
- this.f2 = "dying";
- this.c = 0;
- this.speed = this.speedOrig = 3;
- this.cv = 1;
- this.clip.eyeClip.gotoAndPlay(20);
- this.clip.gotoAndPlay("spin");
- this.clip.swapDepths(_root.d + 9999);
- }
- function dying()
- {
- this.c = this.c + 1;
- if(this.c == 1)
- {
- var _loc9_ = _root.getAngleRad2(this.x,this.y,500,300);
- var _loc10_ = _root.getDist2(this.x,this.y,500,300);
- var _loc8_ = _loc10_ >= 100 ? (_loc10_ + 200) / 300 : 1;
- this.xMovT = Math.cos(_loc9_) * this.speed * _loc8_;
- this.yMovT = Math.sin(_loc9_) * this.speed * _loc8_;
- }
- if(this.c == 15)
- {
- var _loc4_ = _root.powerUps.slice();
- var _loc3_ = 0;
- var _loc5_ = _loc4_.length;
- while(_loc3_ < _loc5_)
- {
- _root.removePowerUp(_loc4_[_loc3_]);
- _loc3_ = _loc3_ + 1;
- }
- _loc9_ = _root.getAngleRad2(this.x,this.y,500,300);
- _loc10_ = _root.getDist2(this.x,this.y,500,300);
- _loc8_ = _loc10_ >= 100 ? (_loc10_ + 200) / 300 : 1;
- this.xMovT = Math.cos(_loc9_) * this.speed * _loc8_;
- this.yMovT = Math.sin(_loc9_) * this.speed * _loc8_;
- }
- if(this.x > 400 && this.x < 600 && (this.y > 200 && this.y < 400) && !this.centered && this.c > 15)
- {
- this.centered = true;
- var _loc6_ = this.x <= _root[_root.char].x ? "R" : "L";
- var _loc7_ = _loc6_ != "L" ? -40 : 1020;
- if(_root[_root.char2].tagTeaming)
- {
- _loc6_ = _root[_root.char2].x >= 500 ? "L" : "R";
- _root[_root.char2].endSeq(_loc6_);
- }
- else if(_root.char2 == "bro1")
- {
- _root.bro1 = new classes.bro.Bro1(_loc7_,150);
- _root.addChar("bro1");
- _root.bro1.endSeq(_loc6_);
- }
- else if(_root.char2 == "bro2")
- {
- _root.bro2 = new classes.bro.Bro2(_loc7_,250);
- _root.addChar("bro2");
- _root.bro2.endSeq(_loc6_);
- }
- else if(_root.char2 == "broShip1")
- {
- _root.bro1ShipLevel = 3;
- _root.broShip1 = new classes.bro.BroShip1(_loc7_,350);
- _root.addChar("broShip1");
- _root.broShip1.endSeq(_loc6_);
- }
- else if(_root.char2 == "broShip2")
- {
- _root.bro2ShipLevel = 3;
- _root.broShip2 = new classes.bro.BroShip2(_loc7_,450);
- _root.addChar("broShip2");
- _root.broShip2.endSeq(_loc6_);
- }
- if(this.xMov > 10 || this.yMov > 10)
- {
- this.cv = 5;
- }
- else
- {
- this.cv = 0.5;
- }
- this.xMovT = 0;
- this.yMovT = 0;
- }
- if(Math.round(this.c / 30) == this.c / 30 && this.c > 90 && this.c < 300)
- {
- _root[_root.char2].endSeqB();
- }
- if(this.c == 240)
- {
- _root[_root.char2].fireDir = "";
- }
- if(this.c == 280)
- {
- this.clip.gotoAndStop("F");
- this.clip.eyeClip.gotoAndStop(60);
- this.clip.eyeClip._visible = true;
- }
- if(this.c == 300)
- {
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(0,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(50,100),_root.randRange(90,100),"Red"]);
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(0,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(50,80),_root.randRange(90,100),"Yellow"]);
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(-20,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(40,80),_root.randRange(50,80),"Yellow"]);
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(-20,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(40,70),_root.randRange(50,80),"Red"]);
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(0,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(50,100),_root.randRange(90,100),"Red"]);
- _root.createExploA([this.x + this.clip.eyeClip._x + _root.randRange(0,40),this.y + this.clip.eyeClip._y + _root.randRange(-10,10),_root.randRange(50,80),_root.randRange(90,100),"Yellow"]);
- this.clip.eyeClip._visible = false;
- this.clip.gotoAndStop("F");
- this.clip.skull._visible = false;
- _root.audio.playLevel2("deathEyeX",_root.randRange(15,25));
- }
- if(this.c == 360)
- {
- _root.audio.playLevel2("deathHeadX",30);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + _root.randRange(-80,80),this.y + this.clip._height / 3 + _root.randRange(-80,80),_root.randRange(50,150),_root.randRange(60,100)]);
- _root.createExploD([this.x + 18,this.y + 18,_root.randRange(180,250),_root.randRange(90,100)]);
- _loc3_ = 0;
- _loc5_ = _root.randRange(6,10);
- while(_loc3_ < _loc5_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"bugA","red",true,true]);
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- _loc5_ = _root.randRange(6,10);
- while(_loc3_ < _loc5_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"batB","green",true,true]);
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- _loc5_ = _root.randRange(6,10);
- while(_loc3_ < _loc5_)
- {
- _root.createShrapnel([this.x + this.clip._width / 2,this.y + this.clip._height / 2,"droidA","blue",true,true]);
- _loc3_ = _loc3_ + 1;
- }
- _root.audio.playLevel4("deathHeadX",_root.randRange(15,25));
- this.clip.skull._visible = true;
- this.clip.skull.gotoAndPlay("end");
- this.clip.head._visible = false;
- this.clip.teeth._visible = false;
- this.clip.cover._visible = false;
- }
- if(this.c > 360)
- {
- _root.bgDecoClip._alpha--;
- this.clip.skull._alpha -= 1;
- this.clip._y -= 0.5;
- }
- if(this.c > 360 && this.c < 420)
- {
- _root[_root.char].xA = _root.randRange2(-5,5) * ((420 - this.c) / 60);
- _root[_root.char2].xA = _root.randRange2(-5,5) * ((420 - this.c) / 60);
- _root[_root.char].yA = _root.randRange2(-5,5) * ((420 - this.c) / 60);
- _root[_root.char2].yA = _root.randRange2(-5,5) * ((420 - this.c) / 60);
- }
- if(this.c == 450)
- {
- _root.bgDecoClip.removeMovieClip();
- _root.endSeq();
- }
- if(this.c == 560)
- {
- _root.removeChar("deathHead");
- }
- }
- function createEnemy1(dir)
- {
- _root.charID = _root.charID + 1;
- _root["droidD" + _root.charID] = new classes.enemy.DroidD(this.x + 6,this.y + 6,[dir,100,"break"],_root.charID);
- _root.addChar("droidD" + _root.charID);
- }
- function createEnemy2(dir)
- {
- _root.charID = _root.charID + 1;
- _root["batD" + _root.charID] = new classes.enemy.BatD(this.x + 6,this.y + 6,[dir,100,"break"],_root.charID);
- _root.addChar("batD" + _root.charID);
- }
- function createEnemy3(dir)
- {
- _root.charID = _root.charID + 1;
- _root["headD" + _root.charID] = new classes.enemy.HeadD(this.x + 12,this.y + 12,[dir,100,"break"],_root.charID);
- _root.addChar("headD" + _root.charID);
- }
- function createEnemy4(dir)
- {
- _root.charID = _root.charID + 1;
- _root["bugD" + _root.charID] = new classes.enemy.BugD(this.x + 6,this.y + 6,[dir,100,"break"],_root.charID);
- _root.addChar("bugD" + _root.charID);
- }
- function changePhase(pphase)
- {
- this.phase = pphase;
- if(this.phase == 5)
- {
- this.fury();
- }
- }
- function fury2()
- {
- _root.audio.playLevel2("deathFury" + (random(2) + 2),_root.randRange(30,35));
- this.f2 = "furious2";
- this.c = 0;
- this.ep = _root.randRange(20,60);
- this.speed = this.speedOrig * 4;
- this.colorTrans = new flash.geom.ColorTransform(1,0,0,1,255,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- _root.audio.playLevel2("deathFury2",_root.randRange(30,35));
- if(random(2) == 0)
- {
- this.dir = _root.getDir(this.x,this.y);
- this[this.axis + "MovT"] = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- }
- }
- function furious2()
- {
- this.colorTrans = new flash.geom.ColorTransform(1,_root.randRange2(0,0.2),0,1,_root.randRange(150,255),_root.randRange(0,30),0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- if(random(25 + _root.dif.wait * 2) == 0)
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathFizzle" + _root.enemyShotID] = new classes.shots.DeathFizzle(this.x,this.y,_root.enemyShotID);
- _root.addEnemyShot("deathFizzle" + _root.enemyShotID);
- _root.audio.playLevel3("deathFizzle" + (random(3) + 1),_root.randRange(10,18));
- }
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- if(random(5) == 0)
- {
- this.dir = _root.getDir(this.x,this.y);
- this[this.axis + "MovT"] = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- }
- this.cv = 0.75 + _root.getDist(this.x,this.y) / 750;
- this.c = this.c + 1;
- if(this.c >= this.ep)
- {
- this.f2 = "wander";
- this.cv = 0.3;
- this.speed = this.speedOrig;
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- }
- function fury()
- {
- this.f2 = "furious";
- this.c = 0;
- this.ep = _root.randRange(450,750);
- this.speed = this.speedOrig * 4;
- this.colorTrans = new flash.geom.ColorTransform(1,0,0,1,255,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- _root.audio.playLevel2("deathFury",_root.randRange(39,45));
- _root.playBGSound(["deathTheme",50,3,0.05]);
- }
- function furious()
- {
- this.colorTrans = new flash.geom.ColorTransform(1,_root.randRange2(0,0.2),0,1,_root.randRange(150,255),_root.randRange(0,30),0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- if(random(25 + _root.dif.wait * 2) == 0)
- {
- _root.enemyShotID = _root.enemyShotID + 1;
- _root["deathFizzle" + _root.enemyShotID] = new classes.shots.DeathFizzle(this.x,this.y,_root.enemyShotID);
- _root.addEnemyShot("deathFizzle" + _root.enemyShotID);
- _root.audio.playLevel3("deathFizzle" + (random(3) + 1),_root.randRange(10,18));
- }
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- if(random(6) == 0)
- {
- this.dir = _root.getDir(this.x,this.y);
- this[this.axis + "MovT"] = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- }
- this.cv = 0.75 + _root.getDist(this.x,this.y) / 750;
- this.c = this.c + 1;
- if(this.c >= this.ep)
- {
- this.permitHit = true;
- _root.level = 5;
- this.f2 = "wander";
- this.phase = 6;
- this.cv = 0.3;
- this.speed = this.speedOrig;
- this.speed += 1;
- this.speedOrig = this.speed;
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.transL.colorTransform = this.colorTrans;
- this.transR.colorTransform = this.colorTrans;
- }
- if(_root.deathDarkClip.end)
- {
- _root.deathDarkClip.removeMovieClip();
- this.clip.cover._alpha = 100;
- this.dark = false;
- }
- }
- function main()
- {
- this[this.f2]();
- if(this.oldDir != this.dir && this.f2 != "intro")
- {
- this.clip.gotoAndStop(this.dir);
- }
- this.oldDir = this.dir;
- if(this.phase == 6)
- {
- var _loc12_ = _root.getAngleRad(this.x,this.y);
- _root[_root.char].xA = Math.cos(_loc12_) * (-1 * this.speed / 8);
- _root[_root.char].yA = Math.sin(_loc12_) * (-1 * this.speed / 8);
- }
- if(this.f2 != "dying")
- {
- if(this.f2 == "wander" || this.f2 == "waiting" && this.phase != 6)
- {
- var _loc11_ = _root.getDist(this.x,this.y);
- var _loc8_ = 0;
- if(_loc11_ >= 400)
- {
- _loc8_ = 1;
- }
- else if(_loc11_ <= 100)
- {
- _loc8_ = 13;
- }
- else
- {
- _loc8_ = Math.ceil((400 - _loc11_) / 23);
- if(random(4) == 0)
- {
- _loc8_ += _root.randRange(-1,1);
- }
- }
- if(_loc8_ + 1 < this.oldF)
- {
- _loc8_ = this.oldF - 1;
- }
- else if(this.oldF + 1 < _loc8_)
- {
- _loc8_ = this.oldF + 1;
- }
- this.clip.eyeClip.eyeL.gotoAndStop(_loc8_ + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(_loc8_ + this.eyes.rO);
- }
- if(this.phase == 6)
- {
- this.clip.eyeClip.eyeL.gotoAndStop(13 + this.eyes.lO);
- this.clip.eyeClip.eyeR.gotoAndStop(13 + this.eyes.rO);
- }
- this.oldF = this.clip.eyeClip.eyeL._currentframe - this.eyes.lO;
- var _loc5_ = Math.round((_root[_root.char].x - this.x + 100) / 20) + 1;
- if(_loc5_ < 1)
- {
- _loc5_ = 1;
- }
- if(_loc5_ > 11)
- {
- _loc5_ = 11;
- }
- this.eyes.lO = _loc5_ > 4 ? 14 : 0;
- this.eyes.rO = _loc5_ < 8 ? 14 : 29;
- if(_loc5_ <= 5)
- {
- this.dir = "L";
- }
- else if(_loc5_ >= 7)
- {
- this.dir = "R";
- }
- else
- {
- this.dir = "F";
- }
- if(this.f2 == "astroAttacking" && this.c > 50 && this.c < 90)
- {
- if(this.eyes.lO == 0)
- {
- this.clip.eyeClip.eyeL.gotoAndStop(this.c);
- }
- else
- {
- this.clip.eyeClip.eyeL.gotoAndStop(this.c + 40);
- }
- if(this.eyes.rO == 29)
- {
- this.clip.eyeClip.eyeR.gotoAndStop(this.c + 80);
- }
- else
- {
- this.clip.eyeClip.eyeR.gotoAndStop(this.c + 40);
- }
- }
- this.clip.eyeClip.gotoAndStop(_loc5_);
- }
- if(this.nudging)
- {
- this.xA *= 0.5;
- this.yA *= 0.5;
- this.nc = this.nc + 1;
- if(this.nc == 15)
- {
- this.xA = this.yA = 0;
- this.nudging = false;
- }
- }
- var _loc4_ = 0;
- var _loc9_ = _root.broShots.length;
- while(_loc4_ < _loc9_)
- {
- var _loc7_ = _root.broShots[_loc4_] + "Clip";
- if(this.clip.head.hitTest(_root[_loc7_]) && this.f2 != "intro")
- {
- var _loc3_ = _root.broShots[_loc4_];
- var _loc6_ = this.life;
- if(this.f2 != "dying")
- {
- if(this.permitHit)
- {
- this.life -= _root[_loc3_].power;
- if(this.life < 1)
- {
- this.f2 = "death";
- }
- else
- {
- this.nudge(_root[_loc3_].xMov,_root[_loc3_].yMov,10);
- _root.audio.playLevel4("deathHit" + (random(3) + 1),_root.randRange(14,22));
- if(this.f2 != "furious" && this.f2 != "walling" && this.f2 != "furious2" && this.f2 != "deathBallAttacking" && this.f2 != "creatingEnemies")
- {
- if(random(10) == 0)
- {
- this.fury2();
- }
- else
- {
- this[this.axis + "MovT"] = 0;
- this.axis = random(10) <= 4 ? "y" : "x";
- this[this.axis + "MovT"] = random(2) <= 0 ? -1 * this.speed : this.speed;
- this.getDirString();
- }
- }
- this.speed = this.speedOrig = 20 - Math.round(this.life / (this.lifeOrig / 10));
- this.cv = 0.25 + (this.lifeOrig - this.life) / 10000;
- _loc5_ = Math.round(100 * ((this.lifeOrig - this.life) / this.lifeOrig));
- this.clip.eyeClip.eyeL.pulse._alpha = _loc5_;
- this.clip.eyeClip.eyeR.pulse._alpha = _loc5_;
- this.clip.skull.gotoAndPlay("f" + (random(3) + 1));
- }
- }
- else
- {
- _root.audio.playLevel4("deathHitNull" + (random(3) + 1),_root.randRange(32,38));
- if(_root.chars.length < 20)
- {
- this["createEnemy" + this.phase](_root[_loc3_].dir);
- }
- }
- }
- else
- {
- _root.audio.playLevel4("deathHit" + (random(3) + 1),_root.randRange(14,22));
- }
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
- _root[_loc3_].exploX = this.x + this.clip._width / 2;
- _root[_loc3_].exploY = this.y + this.clip._height / 2;
- _root[_loc3_].hit(_loc6_);
- break;
- }
- _loc4_ = _loc4_ + 1;
- }
- if(this.clip.head.hitTest(_root[_root.char + "Clip"]) && this.f2 != "intro" && this.f2 != "dying")
- {
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- }
- if(this.f2 != "walling" && this.f2 != "dying")
- {
- var _loc10_ = false;
- if(this.x > 950)
- {
- _loc10_ = true;
- this.dir = "L";
- }
- else if(this.x < 50)
- {
- _loc10_ = true;
- this.dir = "R";
- }
- else if(this.y < 50)
- {
- _loc10_ = true;
- this.dir = "D";
- }
- else if(this.y > 550)
- {
- _loc10_ = true;
- this.dir = "U";
- }
- if(_loc10_)
- {
- this.xMovT = 0;
- this.yMovT = 0;
- this.axis = !(this.dir == "L" || this.dir == "R") ? "y" : "x";
- this[this.axis + "MovT"] = !(this.dir == "L" || this.dir == "U") ? this.speed : -1 * this.speed;
- }
- }
- else
- {
- if(this.y < -50)
- {
- this.y = 620;
- }
- if(this.y > 650)
- {
- this.y = -40;
- }
- }
- if(this.xMovT < this.xMov)
- {
- this.xMov -= this.cv;
- }
- else if(this.xMovT > this.xMov)
- {
- this.xMov += this.cv;
- }
- else
- {
- this.xMov = this.xMovT;
- }
- if(this.yMovT < this.yMov)
- {
- this.yMov -= this.cv;
- }
- else if(this.yMovT > this.yMov)
- {
- this.yMov += this.cv;
- }
- else
- {
- this.yMov = this.yMovT;
- }
- this.x += this.xMov + this.xA;
- this.y += this.yMov + this.yA + 1 * Math.sin(this.hc += 0.05);
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-